/*
 * Copyright (c) ycq_work@163.com
 */

package com.mxg.blog.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.mxg.blog.entity.Article;

import java.util.List;

/**
 * @Author: ycq_work@163.com
 * @DATE: 2023/5/8 23:05
 * 文章表的接口
 */
public interface ArticleService extends IService<Article> {
    Article getArticleByArticleTitle(String articleTitle);

    // 新建原创文章
    void insertOriginalityArticle(String articleTitle, String articleContentHtml, String articleContentMd,
                                  Integer articleStatus, String articleTags,
                                  String articleImages, String articleExcerpt,
                                  Integer articleCategoryId);

    // 新建非原创文章
    void insertUnoriginalityArticle(String articleTitle, String articleContentHtml, String articleContentMd,
                                    Integer articleStatus, String articleTags,
                                    /*Integer articleIsOriginal, String articleSourcesUrl,*/
                                    String articleImages, String articleExcerpt,
                                    Integer articleCategoryId);

    // 保存草稿
    void saveArticle (String articleTitle, String articleContentHtml, String articleContentMd, Integer articleStatus);

    // 更新文章
    void updateArticle (String articleTitle, String articleContentHtml, String articleContentMd,
                        Integer articleStatus, String articleTags,
                        String articleImages, String articleExcerpt,
                        Integer articleCategoryId, Integer articleId);

    // 查询已发布的文章
    List<Article> getArticleByUserIdAndStatus1(Integer articleAuthorId);

    // 查询草稿的文章
    List<Article> getArticleByUserIdAndStatus2(Integer articleAuthorId);

    //查询已删除的文章
    List<Article> getArticleByUserIdAndStatus0(Integer articleAuthorId);

    // 根据文章分类查询文章
    List<Article> accordingToClassificationTheQuery(Integer articleAuthorId, Integer articleCategoryId);

    // 根据文章分类查询文章 已发布
    List<Article> accordingToClassificationTheQueryStatus1(Integer articleAuthorId, Integer articleCategoryId);

    // 根据文章id查询文章
    Article getArticleByArticleId(Integer articleId);

    // 逻辑删除文章
    void deleteArticleStatus0(Integer articleId);

    // 恢复文章至草稿箱
    void restoreDraftArticlesToBox(Integer articleId);

    // 物理删除文章
    void deleteParamsByIds(Integer articleId);

    // 浏览量加一
    void viewsPlusOne(Integer articleId);
}
